package bit.mybatisplusdemo.demos.mapper;

import bit.mybatisplusdemo.demos.model.UserInfo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


import java.util.List;

@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo> {
    @Select("select * from user_info ${ew.customSqlSegment}")
    List<UserInfo> queryUserByCustom(@Param(Constants.WRAPPER) Wrapper<UserInfo> wrapper);

    List<UserInfo> queryUserByCustom2(@Param(Constants.WRAPPER) Wrapper<UserInfo> wrapper);

    @Update("update user_info set age=age+#{addAge} ${ew.customSqlSegment}")
//    void updateUserByCustom(@Param("addAge") int addAge,@Param(Constants.WRAPPER) Wrapper<UserInfo> wrapper);
    void updateUserByCustom(@Param("addAge") int addAge,@Param("ew") Wrapper<UserInfo>wrapper);
}

